package com.talend.support.dashboard.beans;

import java.io.Serializable;
import javax.annotation.PostConstruct;
import javax.faces.bean.ManagedBean;
import javax.faces.bean.RequestScoped;

import org.primefaces.model.chart.CartesianChartModel;
import org.primefaces.model.chart.ChartSeries;

@SuppressWarnings("serial")
@ManagedBean
@RequestScoped
public class AreaChart implements Serializable {

    private CartesianChartModel categoryModel;

	public AreaChart() {
	}

    public CartesianChartModel getCategoryModel() {
        return categoryModel;
    }

    @PostConstruct
    public void init() {
        categoryModel = new CartesianChartModel();

        ChartSeries excellent = new ChartSeries();
        excellent.setLabel("Excellent");

        excellent.set("February", 95);
        excellent.set("March", 95);
        excellent.set("April", 95);
        excellent.set("May", 95);
        excellent.set("June", 95);
        
        ChartSeries good = new ChartSeries();
        good.setLabel("Good");

        good.set("February", 38);
        good.set("March", 49);
        good.set("April", 36);
        good.set("May", 55);
        good.set("June", 61);
        
        ChartSeries average = new ChartSeries();
        average.setLabel("Average");

        average.set("February", 23);
        average.set("March", 22);
        average.set("April", 25);
        average.set("May", 11);
        average.set("June", 8);

        ChartSeries poor = new ChartSeries();
        poor.setLabel("Poor");

        poor.set("February", 4);
        poor.set("March", 8);
        poor.set("April", 5);
        poor.set("May", 9);
        poor.set("June", 3);

        categoryModel.addSeries(excellent);
        categoryModel.addSeries(good);
        categoryModel.addSeries(average);
        categoryModel.addSeries(poor);
    }
}
                    